import { ecs } from "db://app-game/libs/ecs/ECS";
import { ECSEntity } from "db://app-game/libs/ecs/ECSEntity";
import { BTTreeComp } from "../model/BTTreeComp";

/**
 * @en Behavior Tree System
 * @zh 行为树系统
 */
@ecs.register("BTTree")
export class BTTreeSystem
  extends ecs.ComblockSystem
  implements ecs.ISystemUpdate
{
  filter(): ecs.IMatcher {
    return ecs.allOf(BTTreeComp);
  }

  update(entity: ECSEntity, dt: number) {
    const bTTreeComp = entity.get(BTTreeComp);
    bTTreeComp.behaviorManager.update(dt);
  }
}
